--- title: "(50分 多路归并 二分)技能升级" created: 2025-11-28 tags: - 算法 --- # (50分 多路归并 二分)技能升级 ## 题目 [技能升级](https://www.acwing.com/problem/content/4659/) ![[image-dd6f2faa.png]] ## 思路分析 每次加点提升最多的 用大根堆维护 拿到了一半的分 知足了 (前年py b组第8题) ```cpp #include using namespace std; typedef pair PII; priority_queue heap; int n,m; int main() { cin>>n>>m; for(int i=0;i>a>>b; heap.push({a,b}); } int res=0; while(m--){ int addval=heap.top().first; int delval=heap.top().second; int nextaddval=heap.top().first-delval; heap.pop(); res+=addval; heap.push({nextaddval,delval}); } cout<